<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JQuery翻页</title>
<style>
@charset "utf-8";
* {margin:0px;padding:0px;border:0px;list-style-type:none;font-size:12px;font-family:arial, "Microsoft Yahei", "宋体";}
.pages {text-align:center;width:100%;margin:20px auto;padding-top:20px;height:26px;overflow:hidden;}
.pages a {padding:5px;border:1px solid #CCC;margin:0px 5px;text-decoration:none;color:#333;}
.pages a:hover {border:1px solid #FC0;color:#F60;}
.pages .this {border:1px solid #FC0;color:#F60;}
</style>
<script src="../../vendor/jquery-1.11.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
pageShow(1,5800);
function pageShow(ThisPage,PageCount) {
	//ThisPage = 当前页
	//PageCount = 总条数
	//获取当前页之后，可通过Ajax进行返值。
	$(function() {
		//每页条数
		var pageText = 13;
		
		//分页总数
		var pageNumber = Math.ceil(PageCount / pageText);
		
		//page分割数量
		var pageFor = 10;
		var pageSlipt = pageFor / 2;
		
		var pageHTML = new Array;
		if (pageNumber > pageFor) {
			if (ThisPage > pageFor) {
				pageHTML += "<a href=\"javascript:pageShow(1,'"+PageCount+"');\">第一页(1)</a>";
			}
			if (ThisPage > (pageFor / 2)) {
				if (ThisPage >= (pageNumber - pageSlipt)) {
					countPage = (((ThisPage - pageSlipt) + pageFor) - pageSlipt + 1);
				}else{
					countPage = ((ThisPage - pageSlipt) + pageFor);
				}
				for (i=(ThisPage - pageSlipt);i<countPage;i++) {
					if (i == ThisPage) {
						pageHTML += "<a href=\"javascript:pageShow("+i+",'"+PageCount+"');\" class=\"this\">" +i+ "</a>";
					}else{
						pageHTML += "<a href=\"javascript:pageShow("+i+",'"+PageCount+"');\">" +i+ "</a>";
					}
				}
			}else{
				for (i=1;i<pageFor;i++) {
					if (i == ThisPage) {
						pageHTML += "<a href=\"javascript:pageShow("+i+",'"+PageCount+"');\" class=\"this\">" +i+ "</a>";
					}else{
						pageHTML += "<a href=\"javascript:pageShow("+i+",'"+PageCount+"');\">" +i+ "</a>";
					}
				}
			}
			if ((ThisPage + pageFor) < pageNumber) {
				pageHTML += "<a href=\"javascript:pageShow("+pageNumber+",'"+PageCount+"');\">最后一页("+pageNumber+")</a>";
			}
			$(".pages").html(pageHTML);
		}
	});
}
</script>
</head>

<body>
<div class="pages"></div>
</body>
</html>